<?php

/**
 * Form di iscrizione ad un evento 
 */

class Application_Form_SearchForm extends Zend_Form
{
    public function init()
    {   
//        $query = $this->createElement('text', 'query');
//        $query->setLabel('Keywords');
//        $query->setRequired(TRUE);
//        $query->setAttrib('size', 20);
//        $this->addElement($query);
        
        // Add Autocomplete Element
        $elem = new ZendX_JQuery_Form_Element_AutoComplete(
                        "query", array('label' => 'Cerca un evento:')
                    );
        $eventos = new Application_Model_Eventos;
        $allTitles = $eventos->getAllTitles();
        
        $elem->setJQueryParams(array('source' => $allTitles));
        $this->addElement($elem);
        
        $submit = $this->createElement('submit', 'search');
        $submit->setLabel('Cerca un evento');
        $submit->setDecorators(array('ViewHelper'));
        $this->addElement($submit);
    }
}